#pragma once
#include <Python.h>
#include <atomic>
#include <shared_mutex>
#include "pyhashmap.h"
#include <mutex>
#include <stdio.h>
#include "pydatavec.h"
#include "pyobjsize.h"
#include <vector>
#include "threadlock.h"
#include "threadfreevec.h"
class pydatadiskvec:public pydatavec{
public:
	pydatadiskvec(double vecsizeg, unsigned long long workwritenum, unsigned long long workreadnum,double mapsizeg,double seccacheg,
		double diskcacheg, char* filediskvecname, bool testmode,
		double autoh, char* filemapname, char* diskcachedir);
	pydatadiskvec(double vecsizeg,char* filediskvecname, bool testmode);
	~pydatadiskvec();
protected:
	std::mutex memorymutex;
	double vecsizeg;
	unsigned long long workwritenum;
	unsigned long long workreadnum;
	double mapsizeg;
	long long diskcache;
	threadlock filediskvecname;
	bool testmode;
	threadlock filemapname;
	double autoh;
	threadlock diskcachedir;
	std::atomic<long long> disksize = 0;
	std::atomic<bool> threadsign = false;
	void diskget();
	void load();
	void diskput();
	std::mutex sizegetlock;
	pyobjsize sizegetmain;
	double seccacheg;
	pyhashmap* savehash;
	threadfreevec<std::string> filevec;
};